<template>
  <div>
    {{ $store.state.a.num }}
    {{ $store.state.b.num }}
    <hr/>
    {{num}}
    {{num2}}

    <button @click="add">+</button>
  </div>
</template>

<script>
import { mapState ,mapMutations} from 'vuex'
export default {
  methods:{
    add(){
      // this.$store.commit('a/addNum')
      // this.$store.commit('b/addNum')
      // this.addNum();
      // this['a/addNum']();
      /* 
      {
        addNum(){

        }
      }

      obj.addNum

      obj['addNum']()
      */

     this.addNum()
    },
    // ...mapMutations(['a/addNum','b/addNum'])
    ...mapMutations('a',['addNum'])
  },
 computed:{
   ...mapState({
     num : (state)=>state.a.num,
     num2 :(state) => state.b.num
   })
 }
}
</script>

<style lang="scss" scoped>

</style>